package com.intel.two.listener.medical;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.intel.two.bo.medical.ArmariumBo;
import com.intel.two.pojo.building.Resident;
import com.intel.two.pojo.medical.Armarium;
import com.intel.two.service.medical.ArmariumService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @Author:xiaofeia
 * @DATE:2022/10/15
 */
@Component
@Scope("prototype") //多例模式
public class WebArmariumBoListener extends AnalysisEventListener<ArmariumBo> {
    @Autowired
    ArmariumService armariumService;

    @Override
    public void invoke(ArmariumBo data, AnalysisContext context) {
        System.out.println(data);
        Armarium armarium = new Armarium();
        BeanUtils.copyProperties(data, armarium);
        armariumService.addArmarium(armarium);

    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {


    }
}
